import { http } from '@/utils/http/axios';

export interface BasicPageParams {
  pageNumber: number;
  pageSize: number;
  total: number;
}

/**
 * @description: 获取用户列表
 */
export function userList(data) {
  return http.request({
    url: '/users/search',
    method: 'post',
    data,
  });
}

/**
 * @description: 创建用户
 */
export function addUser(data) {
  return http.request({
    url: '/user',
    method: 'post',
    data,
  });
}

/**
 * @description: 编辑用户
 */
export function editUser(data) {
  return http.request({
    url: '/user',
    method: 'PATCH',
    data,
  });
}

/**
 * @description: 用户信息
 */
export function userInfo(id) {
  return http.request({
    url: `/user/${id}`,
    method: 'get',
  });
}

/**
 * @description: 删除用户
 */
export function deleteUser(id) {
  return http.request({
    url: `/user/${id}`,
    method: 'delete',
  });
}

/**
 * @description: 注册用户
 */
export function register(data) {
  return http.request({
    url: `/register`,
    method: 'post',
    data,
  });
}
